package org.example.infrastructure.repository.orm.database;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.example.domain.model.entity.url.UrlShortenerBrowserStats;
import org.example.domain.model.entity.url.req.UrlShortenerGroupStatsReq;
import org.example.domain.model.entity.url.req.UrlShortenerStatsReq;
import org.example.domain.repository.UrlShortenerBrowserStatsRepository;
import org.example.infrastructure.persistence.orm.UrlShortenerBrowserStatsMapper;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;

@Component
@Slf4j
@RequiredArgsConstructor
public class MybatisUrlShortenerBrowserStatsRepository implements UrlShortenerBrowserStatsRepository {
    private final UrlShortenerBrowserStatsMapper urlShortenerBrowserStatsMapper;

    @Override
    public void insertUrlShortenerBrowserStats(UrlShortenerBrowserStats urlShortenerBrowserStats) {
        urlShortenerBrowserStatsMapper.insertUrlShortenerBrowserStats(urlShortenerBrowserStats);
    }

    @Override
    public List<HashMap<String, Object>> browserStatsByUrlShortenerList(UrlShortenerStatsReq urlShortenerStatsReq) {
        return urlShortenerBrowserStatsMapper.browserStatsByUrlShortenerList(urlShortenerStatsReq);
    }

    @Override
    public List<HashMap<String, Object>> browserStatsByGroupList(UrlShortenerGroupStatsReq urlShortenerGroupStatsReq) {
        return urlShortenerBrowserStatsMapper.browserStatsByGroupList(urlShortenerGroupStatsReq);
    }
}
